home *** CD-ROM | disk | FTP | other *** search
- /* C K U S R 2 -- "User Interface" STRINGS module for CTOS-Kermit */
- /* Modifications-Joel Dunn, UNC-CH, 9/21/87 clean up, make sure -h pauses */
- /* -Doug Drury ITT-FSC, 6/91 added messages for added commands */
-
- /* This module separates long strings from the body of the ckuser module. */
-
- #include "ctermi.h"
- #include "ctcmd.h"
- #include "ctuser.h"
-
- extern char cmdbuf[];
- extern int nrmt, nprm, dfloc;
- extern char *dftty;
- extern struct keytab prmtab[];
- extern struct keytab remcmd[];
-
- static
- char *hlp1[] = {"\377PN\n\
- Usage: kermit [-x arg [-x arg]...[-yyy]..]]\n\
- x is an option that requires an argument, y an option with no argument:\n\
- actions (* options also require -l and -b) --\n\
- -O commands perform commands after -O\n\
- -s file send \n\
- -r receive\n\
- -k receive to stdout\n\
- * -g file get remote file from server (wildcards not allowed)\n\
- -a name alternate name, used with -s, -r, -g\n\
- -x enter server mode\n\
- * -f finish remote server\n\
- * -c connect before transaction\n\
- * -n connect after transaction\n\
- -h help - print this message\n\
- settings --\n\
- -l line communication line device\n\
- -b baud line speed, e.g. 1200\n\
- -i binary file\n\
- -p x parity, x is one of e,o,m,s,n\n\
- -t line turnaround handshake = xon, half duplex\n\
- -w don't write over preexisting files\n\
- -q be quiet during file transfer\n\
- -d log debugging info to debug.log\n\
- *** for an action or setting that has 2 parts, use 2 CTOS parameters ***\n\
- If no action command is included, enter interactive dialog.\n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n\
- \n",
- ""
- };
-
- /* U S A G E */
-
- usage() {
- conola(hlp1);
- }
-
- /* Help string definitions */
-
- static char *tophlp[] = { "\n\
- Type ? for a list of commands, type 'help x' for any command x.\n\
- While typing commands, use the following special characters:\n\n\
- DELETE, BACKSPACE: Delete the most recent character typed.\n\
- F3: Delete the most recent word typed.\n",
-
- "\
- F1: Delete the current line.\n\
- RIGHT ARROW: Redisplay the current line.\n\
- ? (question mark) display help on the current command or field.\n\
- RETURN Attempt to complete the current field.\n",
-
- "\
- \\ (backslash) include the following character literally.\n\n\
- From command line, run ckermit.run, parm1 = -h to get help on command args.\
- \n",
- "" };
-
- static char *hmxxask = "\
- Format: 'ask[q] \\\\%x prompt', where x is any letter (A-Z, a-z) and prompt\n\
- is any printable set of characters. Issues the prompt and defines the\n\
- variable to be up to 20 non-control characters entered. With askq, the\n\
- characters entered do not echo to the screen.";
-
- static char *hmxxass = "\
- Format: 'assign \\\\%x text', where x is any letter (A-Z, a-z) and text\n\
- is any printable set of up to 20 characters. Assigns the current value of\n\
- the text to the variable (macro). The definition text is fully evaluated\n\
- before it is assigned, so that, the values of any referenced variables are\n\
- used, rather than their names. Variables may not be used for keywords.";
-
- static char *hmxxbye = "\
- Shut down and log out a remote Kermit server";
-
- static char *hmxxclo = "\
- Close one of the following logs:\n\
- session, transaction, packet, debugging -- 'help log' for further info.";
-
- static char *hmxxcon = "\
- Connect to a remote system via the tty device given in the\n\
- most recent 'set line' command";
-
- static char *hmxxget = "\
- Format: 'get filespec'. Tell the remote Kermit server to send the named\n\
- files. If filespec is omitted, then you are prompted for the remote and\n\
- local filenames separately.";
-
- static char *hmxxlg[] = { "\
- Record information in a log file:\n\n\
- debugging Debugging information, to help track down\n\
- (default debug.log) bugs in the CTOS-Kermit program.\n\n\
- packets Kermit packets, to help track down protocol problems.\n\
- (packet.log)\n\n\
- session Terminal session, during CONNECT command.\n\
- (session.log)\n\n\
- transactions Names and statistics about files transferred.\n\
- (transaction.log)",
- "" } ;
-
- static char *hmxxlogi[] = { "\
- Syntax: script text\n\n\
- Login to a remote system using the text provided. The login script\n\
- is intended to operate similarly to uucp \"L.sys\" entries.\n\
- A login script is a sequence of the form:\n\n\
- expect send [expect send] . . .\n\n\
- where 'expect' is a prompt or message to be issued by the remote site, and\n\
- 'send' is the names, numbers, etc, to return. The send may also be the\n\
- keyword EOT, to send control-d, or BREAK, to send a break. Letters in\n\
- send may be prefixed by ~ to send special characters. These are:\n\
- ~b backspace, ~s space, ~q '?', ~n linefeed, ~r return, ~c don\'t\n\
- append a return, and ~o[o[o]] for octal of a character. As with some \n\
- uucp systems, sent strings are followed by ~r unless they end with ~c.\n\n\
- Only the last 7 characters in each expect are matched. A null expect,\n\
- e.g. ~0 or two adjacent dashes, causes a short delay. If you expect\n\
- that a sequence might not arrive, as with uucp, conditional sequences\n\
- may be expressed in the form:\n\n\
- -send-expect[-send-expect[...]]\n\n\
- where dashed sequences are followed as long as previous expects fail.",
- "" };
-
- static char *hmxxrc[] = { "\
- Format: 'receive [filespec]'. Wait for a file to arrive from the other\n\
- Kermit, which must be given a 'send' command. If the optional filespec is\n\
- given, the (first) incoming file will be stored under that name, otherwise\n\
- it will be stored under the name it arrives with.",
- "" } ;
-
- static char *hmxxsen = "\
- Format: 'send file1 [file2]'.";
-
- static char *hmxxser = "\
- Enter server mode on the currently selected line. All further commands\n\
- will be taken in packet form from the other Kermit program.";
-
- static char *hmhset = "\
- The 'set' command is used to establish various communication or file\n\
- parameters. The 'show' command can be used to display the values of\n\
- 'set' parameters. Help is available for each individual parameter;\n\
- type 'help set ?' to see what's available.\n";
-
- static char *hmxychkt = "\
- Type of packet block check to be used for error detection, 1, 2, or 3.\n\
- Type 1 is standard, and catches most errors. Types 2 and 3 specify more\n\
- rigorous checking, at the cost of higher overhead. Not all Kermit programs\n\
- support types 2 and 3.\n";
-
- static char *hmxyf[] = { "\
- set file: names, type, warning, display.\n\n\
- 'names' are normally 'converted', which means file names are converted\n\
- to 'common form' during transmission; 'literal' means use filenames\n\
- literally.\n",
-
- "\n\
- 'type' is normally 'text', in which conversion is done between CTOS newlines\n\
- and CRLF line delimiters; 'binary' means to do no conversion. Use 'binary'\n\
- for executable programs or binary data.\n",
-
- "\n\
- 'warning' is 'on' or 'off', normally off. When off, incoming files will\n\
- overwrite existing files of the same name. When on, new names will be\n\
- given to incoming files whose names are the same as existing files.\n" ,
-
- "\n\
- 'display' is normally 'on', causing file transfer progress to be displayed\n\
- on your screen when in local mode.\n",
- "" } ;
-
- static char *hmhrmt[] = { "\
- The 'remote' command is used to send file management instructions to a\n\
- remote Kermit server. There should already be a Kermit running in server\n\
- mode on the other end of the currently selected line. Type 'remote ?' to\n",
-
- "\
- see a list of available remote commands. Type 'help remote x' to get\n\
- further information about a particular remote command 'x'.\n" ,
- ""} ;
-
- /* D O H L P -- Give a help message */
-
- dohlp(xx) int xx; {
- int x,y;
-
- if (xx < 0) return(xx);
- switch (xx) {
-
- case XXASS: /* assign */
- return(hmsg(hmxxass));
-
- case XXASK: /* ask, askq */
- case XXASKQ:
- return(hmsg(hmxxask));
-
- case XXBYE:
- return(hmsg(hmxxbye));
-
- case XXCLO:
- return(hmsg(hmxxclo));
-
- case XXCON:
- return(hmsg(hmxxcon));
-
- case XXCWD:
- return(hmsg("\
- Change Working Directory, equivalent to CTOS path command...\n\
- String must be of form [vol]<directory>\n"));
-
- case XXDEL:
- return(hmsg("Delete a local file"));
-
- case XXDIAL:
- return(hmsg("Dial a number using modem autodialer"));
-
- case XXDIR:
- return(hmsg("Display a directory of local files"));
-
- case XXECH:
- return(hmsg("Display the rest of the command on the terminal,\n\
- useful in command files."));
-
- case XXEXI:
- case XXQUI:
- return(hmsg("Exit from the Kermit program, closing any open logs."));
-
- case XXFIN:
- return(hmsg("\
- Tell the remote Kermit server to shut down without logging out."));
-
- case XXGET:
- return(hmsg(hmxxget));
-
- case XXHAN:
- return(hmsg("Cause the modem to hangup the telephone line."));
-
- case XXHLP:
- return(hmsga(tophlp));
-
- case XXIF:
- return(hmsg("\
- Syntax: IF condition statement\n\
- Example: IF SUCCESS EXIT\n\
- Example: IF FAILURE GOTO LABEL1\n\
- Example: IF COUNT GOTO LABEL2\n\
- Example: IF EQUAL text1 text2 ECHO Strings are equal\n\
- Example: IF DEFINED variable_name ECHO The variable has been defined\n\
- Example: IF EXIST filename.ext ECHO The file exists\n\n\
- For SUCCESS and FAILURE, test the condition from the previously executed\n\
- Kermit statement and execute the statement following the condition. For\n\
- COUNT, if the count value is greater than 1, decrement the count; if the\n\
- new count value is greater than zero, execute the statement following the\n\
- condition. For EQUAL, if the two texts are lexically equal, execute the\n\
- statement following the condition. If an IF statement contains\n\
- variables, they will be expanded before statement execution.\n\
- An astrisk may be used as a wild card in an IF EXIST file name."));
-
- case XXINP:
- return(hmsg("\
- Syntax: INPUT n text\n\
- Example: INPUT 5 Login:\n\n\
- Wait up to n seconds for the given text to arrive on the communication line.\n\
- For use in script programs with IF FAILURE and IF SUCCESS.\n\
- Text may be up to 7 bytes."));
-
- case XXRINP:
- return(hmsg("Syntax: REINPUT n string\n\n\
- Look for the string in the text that has recently been INPUT, set SUCCESS\n\
- or FAILURE accordingly. Timeout, n, must be specified but is ignored.\n\
- String may be up to 7 bytes."));
-
- case XXLOG:
- return(hmsga(hmxxlg));
-
- case XXLOGI:
- return(hmsga(hmxxlogi));
-
- case XXOUT:
- return(hmsg("Syntax: OUTPUT text\n\n\
- Send the text out the currently selected line, as if you had typed it\n\
- during CONNECT mode. The text may contain backslash codes. Example:\n\n\
- OUTPUT help\\13"));
-
- case XXPAU:
- return(hmsg("Pause for a specified number of seconds."));
-
- case XXREC:
- return(hmsga(hmxxrc));
-
- case XXREM:
- if ((y = cmkey(remcmd,nrmt,"Remote command","")) == -2) return(y);
- if (y == -1) return(y);
- if (x = (cmcfm()) < 0) return(x);
- return(dohrmt(y));
-
- case XXSEN:
- return(hmsg(hmxxsen));
-
- case XXSER:
- return(hmsg(hmxxser));
-
- case XXSET:
- if ((y = cmkey(prmtab,nprm,"Parameter","")) == -2) return(y);
- if (y == -2) return(y);
- if (x = (cmcfm()) < 0) return(x);
- return(dohset(y));
-
- case XXSHE:
- return(hmsg("\nnot implemented\n"));
-
- case XXSHO:
- return(hmsg("\
- Display current values of 'set' parameters; 'show version' will display\n\
- program version information for each of the CTOS-Kermit modules;\n\
- 'show macros' will display the current values for all variables.\n"));
-
- case XXSPA:
- return(hmsg("Display space available on current volume\n"));
-
- case XXSTA:
- return(hmsg("Display statistics about most recent file transfer"));
-
- case XXTAK:
- return(hmsg("\
- Take Kermit commands from the named file. Kermit command files may\n\
- themselves contain 'take' commands, up to a reasonable depth of nesting."));
-
- default:
- if (x = (cmcfm()) < 0) return(x);
- printf("Not available yet - %s\n",cmdbuf);
- break;
- }
- return(0);
- }
-
- /* H M S G -- Get confirmation, then print the given message */
-
- hmsg(s) char *s; {
- int x;
- if (x = (cmcfm()) < 0) return(x);
- printf("%s\n",s);
- return(0);
- }
-
- hmsga(s) char *s[]; { /* Same function, but for arrays */
- int x, i;
- if ( x = (cmcfm()) < 0) return(x);
- for ( i = 0; *s[i] ; i++ ) { puts(s[i]); fputc('\n', stdout); }
- fputc( '\n', stdout);
- return(0);
- }
-
- /* D O H S E T -- Give help for SET command */
-
- dohset(xx) int xx; {
-
- if (xx == -3) {
- printf(hmhset);
- return(0);
- }
- if (xx < 0) return(xx);
- switch (xx) {
-
- case XYCHKT:
- printf(hmxychkt);
- return(0);
-
- case XYCOUN:
- printf("\
- Useful for implementing TAKE file loops. Count is decremented each time\n\
- a loop is processed.\n");
- return(0);
-
- case XYDELA:
- printf("\
- Number of seconds to wait before sending first packet after 'send' command\n");
- return(0);
-
- case XYDUPL:
- printf("\
- During 'connect': 'full' means remote host echoes, 'half' means this program\n\
- does its own echoing.\n");
- return(0);
-
- case XYEOL:
- printf("\
- Decimal ASCII value for character to terminate outbound packets, normally\n\
- 13 (CR, carriage return). Inbound packets are assumed to end with CR.\n");
- return(0);
-
- case XYESC:
- printf("\
- Decimal ASCII value for escape character during 'connect', normally 27\n\
- ('GO')\n");
- return(0);
-
- case XYFILE:
- printf(hmxyf[0]);
- printf(hmxyf[1]);
- printf(hmxyf[2]);
- printf(hmxyf[3]);
- return(0);
-
- case XYFLOW:
- printf("\
- Type of flow control to be used. Choices are 'xon/xoff' and 'none'.\n\
- normally xon/xoff.\n");
- return(0);
-
- case XYHAND:
- printf("\
- Decimal ASCII value for character to use for half duplex line turnaround\n\
- handshake. Normally, handshaking is not done.\n");
- return(0);
-
- case XYLEN:
- printf("\
- Packet length to use. 90 by default. 94 maximum.\n");
- return(0);
-
- case XYLINE:
- printf("Device name of communication line to use. Normally %s.\n",dftty);
- if (!dfloc) {
- printf("If you set the line to other than %s, then Kermit\n",dftty);
- printf("\
- will be in 'local' mode; 'set line' will reset Kermit to remote mode.\n");
- printf("\
- If the line has a modem, and if the modem-dialer is set to direct, this \n\
- command causes waiting for a carrier detect (e.g., on a hayes type modem). \n\
- This can be used to wait for incomming calls. \n");
- printf("\
- To use the modem to dial out, first set modem-dialer (e.g., to hayes), then \n\
- set line, next issue the dial command, and finally connect \n");
- }
- return(0);
-
- case XYMARK:
- printf("\
- Decimal ASCII value of character that marks the beginning of packets sent by\n\
- this program (normally 1 = Control-A)\n");
- return(0);
-
- case XYMODM:
- printf("\
- Type of modem for dialing remote connections. Needed to indicate modem can\n\
- be commanded to dial without \"carrier detect\" from modem. Many recently\n\
- manufactured modems use \"hayes\" protocol.\n");
- return(0);
-
- case XYNPAD:
- printf("\
- Number of padding characters to request for inbound packets, normally 0.\n");
- return(0);
-
- case XYPADC:
- printf("Decimal ASCII value of inbound padding character, normally 0.\n");
- return(0);
-
- case XYPARI:
- printf("\
- Parity to use during terminal connection and file transfer:\n\
- even, odd, mark, space, or none. Normally none.\n");
- return(0);
-
- case XYPROM:
- printf("Prompt string for this program, normally 'CTOS-Kermit>'.\n");
- return(0);
-
- case XYRETR:
- printf("\
- Number of Retries to use during file transfers.\n");
- return(0);
-
- case XYSPEE:
- printf("\
- Communication line speed for external tty line specified in most recent\n\
- 'set line'. Any of the common baud rates up to 9600.\n");
- return(0);
-
- case XYTAKE:
- printf("\
- Take file ECHO and ERROR on or off. ECHO on causes display of Take File\n\
- progress messages. ECHO off suppresses display of progress messages.\n\
- ERROR on causes Take File processing to abort when any error is encountered\n\
- ERROR off causes Take File processing to continue after an error is\n\
- encountered. This is useful for implementing IF logic.\n");
- return(0);
-
- case XYTIMO:
- printf("\
- Timeout interval for this program to use during file transfer, seconds.\n");
- return(0);
-
- case XYTERM:
- printf("\
- Terminal type, options are 'none' and 'vt100'.\n");
- return(0);
-
- default:
- printf("Not available yet - %s\n",cmdbuf);
- return(0);
- }
- }
-
- /* D O H R M T -- Give help about REMOTE command */
-
- dohrmt(xx) int xx; {
- int x;
- if (xx == -3) {
- printf(hmhrmt[0]);
- printf(hmhrmt[1]);
- return(0);
- }
- if (xx < 0) return(xx);
- switch (xx) {
-
- case XZCWD:
- return(hmsg("\
- Ask remote Kermit server to change its working directory."));
-
- case XZDEL:
- return(hmsg("\
- Ask remote Kermit server to delete the named file(s)."));
-
- case XZDIR:
- return(hmsg("\
- Ask remote Kermit server to provide directory listing of the named file(s)."));
-
- case XZHLP:
- return(hmsg("\
- Ask remote Kermit server to tell you what services it provides."));
-
- case XZHOS:
- return(hmsg("\
- Send a command to the remote system in its own command language\n\
- through the remote Kermit server."));
-
- case XZSPA:
- return(hmsg("\
- Ask the remote Kermit server to tell you about its disk space."));
-
- case XZTYP:
- return(hmsg("\
- Ask the remote Kermit server to type the named file on your screen."));
-
- case XZWHO:
- return(hmsg("\
- Ask the remote Kermit server to list who's logged in, or to give information\n\
- about the specified user."));
-
- default:
- if (x = (cmcfm()) < 0) return(x);
- printf("not working yet - %s\n",cmdbuf);
- return(-2);
- }
- }
-